import { Button, Form, Input, Modal, Select } from 'antd';
import React from 'react';

function FormBox({ title, isModalOpen, handleCancel, onsubAnd, form }) {
    const onFinish = (value) => {
        onsubAnd({
            name: value.name,
            job: value.job,
        });
    };
    return (
        <Modal
            title={title}
            open={isModalOpen}
            onCancel={handleCancel}
            footer={null}
        >
            <Form onFinish={onFinish} form={form}>
                <Form.Item name="id" hidden>
                    <Input />
                </Form.Item>
                <Form.Item name="name">
                    <Input />
                </Form.Item>
                <Form.Item name="job">
                    <Select>
                        <Select.Option value="总经理"></Select.Option>
                        <Select.Option value="销售助理"></Select.Option>
                        <Select.Option value="销售员"></Select.Option>
                    </Select>
                </Form.Item>
                <Form.Item>
                    <Button htmlType="submit">提交</Button>
                </Form.Item>
            </Form>
        </Modal>
    );
}

export default React.memo(FormBox);
